package src;

import java.awt.Graphics;
import java.awt.Rectangle;
import java.util.Random;

public class World {
	
	Block[][] world = new Block[25][20];
	Random rand;
	
	public World(){
		rand = new Random();
		genTerrain();
	}
	
	public void genTerrain(){
		for(int i = 0; i < 25; i++){
			for(int j = 1; j < 20; j++){
				int temp = rand.nextInt(100);
				if(temp >= 0 && temp < 80){
					world[i][j] = new Block("Surface Tile - Normal.png", new Rectangle(i*32, j*32, 32, 32), false);
				}else if(temp >= 80 && temp < 90){
					world[i][j] = new Block("Surface Tile - Hole in middle.png", new Rectangle(i*32, j*32, 32, 32), false);
				}else if(temp >=90 && temp <= 100){
					world[i][j] = new Block("Surface Tile - Two Holes.png", new Rectangle(i*32, j*32, 32, 32), false);
				}
			}
		}
	}
	
	public void draw(Graphics g){
		for(int i = 0; i < 25; i++){
			for(int j = 1; j < 20; j++){
				g.drawImage(world[i][j].img, world[i][j].blockRect.x, world[i][j].blockRect.y, null);
			}
		}
	}
}
